﻿
if (typeof ($) != "undefined") {
    $(document).ready(function () {
        
    });
}
var fnCustomSave = function () {
    var SubjectName = $("#SubjectName").val();
    var SuperiorSubjectID = $("#SuperiorSubjectID").val();
    var SpecificationRemark = $("#SpecificationRemark").val();
    var Remark = $("#Remark").val();
    setValue();
    if (instance[0].SubjectName == "") {
        alert("科目名称不能为空!");
        $("#SubjectName").focus();
        return;
    }
    if (instance[0].SuperiorSubjectID == "") {
        alert("上级科目名称不能为空!");
        $("#txtSuperiorSubjectID").focus();
        return;
    }
    $("#jsonDataContent").val($.toJSON(instance[0]));
    if (confirm("是否确定保存?")) {
        trySave();
    }
}
var trySave = function () {
    var SaveUrl = "AjaxData/CustomOperating.aspx?r=" + Math.random() + "&flag=1&entity=" + entity + "&action=" + action + "&json=";
    var formObject = document.getElementById('form2');
    YAHOO.util.Connect.setForm(formObject);
    var cObj = YAHOO.util.Connect.asyncRequest('POST', SaveUrl, callback);
}
var responseSuccess = function (res) {
    try {
        var str = res.responseText;
        if (str == "1") {
            alert("数据保存成功");
            parent.closeWin();
        } else {
            alert(str);
            return;
        }
    } catch (e) {
    }
    finally {
    }
};
var callback = {
    success: responseSuccess,
    failure: responseFailure
};